<template>


  <div style="align-content: center;width: 1200px;height: 500px" >
    <center>
      <h1 style="width: 350px">管理员登录</h1>
  <van-field label="用户名:" placeholder="请输入用户名" v-model="username" style="width: 350px; "></van-field>
  <van-field label="密码:" placeholder="请输入密码" type="password" :center="true" v-model="password"
             style="width: 350px" ></van-field>
    <van-button @click="login">登录</van-button></center>
</div>
</template>

<script>
export default {
name: "Administrator_login",
  data(){
  return{
    username:'',
    password:''
  }
  },
  mounted() {

  },
  methods:{
  login(){
    // 用户密码验证登录
    this.myaxios('http://localhost:5000/Administrator_login', 'post',
        {
          'username': this.username,
          'password': this.password
        })
        .then(res => {
          console.log(res)
          if (res.code==200){
            // localStorage.setItem('usrid',res.id)
            // localStorage.setItem('token',res.token)
            // localStorage.setItem('username',res.username)
            window.location.href='/back-end_homepage'
          }else if (res.code!=200){
            alert(res.msg)
          }
        })
  }
  }
}
</script>

<style scoped>

</style>
